% author : Lei Yinghaonan
% Creation Date : 2021.11.22
% Last Date : 2021.11.22
% brief : load data from matlab to origin.

clear
clc
cd('E:\work_code\Matlab_code\matlab_origin')
addpath('./origin_tool')
%% --- creat obj ---
obj = CreatOriginObj();
%% --- creat book ---
bookName1 = CreatOriginBook(obj);
bookName2 = CreatOriginBook(obj,'sheetOfBook2');
bookName3 = CreatOriginBook(obj,'sheetOfBook3');
%% --- rename sheet---
sheetName1 = 'sin';
sheet = FindSheet(obj);
RenameSheet(sheet,sheetName1);

sheetName2 = 'cos';
sheet = FindSheet(obj,bookName2);
RenameSheet(sheet,sheetName2);

sheetName3 = 'sin*cos';
sheet = FindSheet(obj,bookName3,'sheetOfBook3');
RenameSheet(sheet,sheetName3)
%% --- creat data---
x = (1:100)';
y = sin(x);
data = [x y];
disp(size(data))
%% --- load data to origin ---
LoadData2Sheet(obj,strcat(bookName,sheetName),data)
%% --- release origin ---
release(obj);
clear obj
%% --- matlab plot ---
h=figure('Color',[1 1 1]);
hplot = plot(data(:,1),data(:,2));

